<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
		<div class="btn-group hidden-xs" id="toolbar" role="group">
			
			<a class="btn btn-outline btn-danger" onclick="javascript:addAllPop()">
				<i class="fa fa-edit"></i> 选择pop点
			</a>
		</div>
			
		<div class="col-sm-12 select-info order-table">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permissionService.hasPermi('module:pop:edit')}]];
        var removeFlag = [[${@permissionService.hasPermi('module:pop:remove')}]];
        var prefix = ctx + "module/pop"

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "Pop点",
                queryParams: queryParams,
                search:false,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'popName', 
					title : 'Pop点' 
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.popId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.popId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        
        
        function getQueryString(name) { 
        	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
        	var r = window.location.search.substr(1).match(reg); 
        	if (r != null) return unescape(r[2]); return null; 
        	} 

        
        function queryParams(params) {
			return {
				cpeId:getQueryString("cpeId")
			};
		}
        
    	function addAllPop() {
		    var rows = $.table.selectColumns("cpeId");
		    var url = ctx + 'module/pop/popOptions?cpeId='+rows;
        	$.modal.openFull("添加Pop点", url, '1024', '800');

		}
    </script>
</body>
</html>